# \donttest{
if (FALSE) {
a <- gpu.matrix(rnorm(9),3,3)
dtype(a) #bits used to store the numbers: it is float64 by default.
b <- a
dtype(b) <- "float32" #change to float32
b
b <- a
dtype(b) <- "int" #change to integer64 (int64)
b
#sparse or dense matrices
A <- gpu.matrix(data=c(1,1,1,0,0,1,0,1,0),3,3)
A #A is a dense gpu.matrix
A_sparse <- to_sparse(A) #transform A to a sparse matrix.
A_sparse #this matrix stores the where number different to 0 were placed.
to_dense(A_sparse) #transform A_sparse to a dense matrix and we obtain the orginal matrix A:
A
}
# }
Run the code above in your browser using DataLab